<!doctype html>
<!--
 * Copyright 2013 The Chromium Authors. All rights reserved.  Use of this
 * source code is governed by a BSD-style license that can be found in the
 * LICENSE file.
-->
<html>
<head>
  <style type="text/css">
    body { margin: 0; padding: 0; }
  </style>
</head>
<body>
  <div>
    <input type="datetime-local" id="date-widget"/>
  </div>

  <script>
    var LOG = function(var_args) {
      window.console.log.apply(window.console, arguments);
    };

    window.addEventListener('message', function(e) {
      LOG('message');
      var data = JSON.parse(e.data);
      LOG('data: ' + data);
      if (data[0] != 'request-connect') {
        return;
      }
      var input = document.getElementById('date-widget');
      // Keep the input focused cause we'll be sending alt+down to open its
      // popup.
      input.focus();

      var msgArray = ['response-connect'];
      e.source.postMessage(JSON.stringify(msgArray), '*');
    });

    document.body.addEventListener('click', function(e) {
      LOG('document.click');
      LOG('e.x/y: ', e.x + ', ' + e.y);
    });
  </script>
</body>
</html>
